#from turbogears import expose
#from mnemoply._renewed_lib.crud import CRUDController, TableCol
#from mnemoply._renewed_model.field import StudentNew as model_Student
#
#from mnemoply._renewed_lib.validators import Schema, tg_validators
#from mnemoply._renewed_constants import today, now
#from mnemoply._renewed_controllers.Personality import PersonalityController
#
#class StudentSchema(Schema):
#    birthday =tg_validators.DateValidator(latest_date=now.replace(year=now.year-3),
#                                          earliest_date=now.replace(year=now.year-70))
#
#class StudentController(PersonalityController):
#    model_object = model_Student
#    mysql_view_name = 'prod_v2.student_lookup'
#    title = _("Student")
#    lookup_columns = [
#        TableCol(name='surname', caption=_('Surname')),
#        TableCol(name='forename', caption=_('Forename')),
#        TableCol(name='patronymic', caption=_('Patronymic')),
#        TableCol(name='phones', caption=_('Phones')),
#        TableCol(name='email', caption=_('e-mail'), hidden=True, size=9),
#        TableCol(name='birthday', caption=_('Birthday'), size=4, hidden=True),
#        TableCol(name='entering_date', caption=_('Entering date'), hidden=True, size=10),
#        TableCol(name='school_name', caption=_('School'), hidden=True, size=4),
#        TableCol(name='school_form', caption=_('Form'), hidden=True, size=4),
#        TableCol(name='academic_year_admission', caption=_('Year'), hidden=True, size=4),
#
#        TableCol(name='surname_translit', caption=_('Surname translit'), size=10, hidden=True),
#        TableCol(name='forename_translit', caption=_('Forename translit'), size=10, hidden=True),
#        TableCol(name='patronymic_translit', caption=_('Patronymic translit'), size=10, hidden=True),
#   ]
#
#    edit_fields = [
#        'accountID',
#        'surname','forename','patronymic',
#        'birthday',
#        'student_typeID',
#        'school_name',
#        'school_form',
#        'academic_year_admission',
#        'email',
#        ]
#
#    view_fields = add_fields =[
#        'accountID',
#        'surname','forename','patronymic',
#        'birthday',
#        'student_typeID',
#        'school_name',
#        'school_form',
#        'academic_year_admission',
#        'email',
#        ]
#
#    chained_validators_edit = [StudentSchema()]
#
#    def before_update(self, data, obj=None):
#        data['isStudent']=1
#        return PersonalityController.before_update(self, data, obj)
#
#    @expose()
#    def get_info(self,**kw):
#        field =i =''
#        res=_('*No value*')
#        per = None
#        field = kw.get('studentID','')
#        if field:
#            i = field.get('hidden','0')
#        if i:
#            per = model_Student.get(int(i))
#            res = per.phone.title
#        return dict(info_studentID=res)
#    get_info.expose_object = True
#
#exposed = StudentController()
